//! Define some Error types
//!
//! In order to deal with different crates inner err type

/// Define error for json_server::config
#[derive(Debug)]
pub enum ConfigError {
    IOError(std::io::Error),
    JsonError(json::Error),
}

impl From<std::io::Error> for ConfigError {
    fn from(e: std::io::Error) -> Self {
        Self::IOError(e)
    }
}

impl From<json::Error> for ConfigError {
    fn from(e: json::Error) -> Self {
        Self::JsonError(e)
    }
}

/// Define error for json_server::data::*
#[derive(Debug)]
pub enum ParserError {
    CSVError(quick_csv::error::Error),
}

impl From<quick_csv::error::Error> for ParserError {
    fn from(e: quick_csv::error::Error) -> Self {
        Self::CSVError(e)
    }
}
